import Api from "@/api/operations/codes";
import i18n from "@/lang/index";
const modalConfig = {
  pageName: "sys:user",
  dialog: {
    title: i18n.global.t('title.17'),
    width: 800,
    appendToBody: true,
    draggable: true,
    labelWidth: "auto",
  },
  formAction: (data) => {
    console.log("add", data);
    return new Promise((resolve, reject) => {
      Api.add(data).then(s => {
        console.log(s);
        resolve(s)
      }).catch(e => {
        reject(e)
      })
    });
  },

  formItems: [
    {
      type: "input",
      label: i18n.global.t("form.56"),
      prop: "actual_amount",
      attrs: {
        placeholder: i18n.global.t("hint.80"),
      },
    },
    {
      type: "date-picker",
      label: i18n.global.t("form.55"),
      prop: "expires_at",
      attrs: {
        type: "datetime",
        placeholder: i18n.global.t("hint.81"),
        format: "YYYY-MM-DD HH:mm:ss",
        'date-format': "YYYY/MM/DD ddd",
        'time-format': "hh:mm:ss",
      },
    }

  ],
  formRules: {
    expires_at: [{ required: true, message: i18n.global.t("hint.81"), trigger: "blur" }],
    actual_amount: [{ required: true, message: i18n.global.t("hint.80"), trigger: "blur" }],
  },
};

export default modalConfig;
